<template>
	<coreshop-page title="邀请列表" mode="left">
	</coreshop-page>
</template>
<script setup lang="ts">
	import { reactive, onMounted } from 'vue';
	import { queryMyInvite } from '@/core/api';
	import type { Response, InviteMsgType, ShopConfigStoreType } from '@/core/models';
	import { useShopConfigStore } from '@/core/store';
	import { onShareAppMessage, onShareTimeline } from '@dcloudio/uni-app';
	import { shareUrl } from '@/core/consts';
	import { handleRouteNavigateTo } from '@/core/utils';

	/** 获取项目配置 */
	const shopConfigStore : ShopConfigStoreType = useShopConfigStore();

	const state = reactive<{
		myInvite : InviteMsgType;
		inviteKey : string | number;
	}>({
		myInvite: {},
		inviteKey: "",
	})

	onMounted(() => {
		getMyInvite();
	});

	const getMyInvite = async () => {
		const myInvite : Response<InviteMsgType> = await queryMyInvite();
		state.myInvite = myInvite?.data;
	}

	onShareAppMessage(() => {
		return {
			title: shopConfigStore.config.shareTitle,
			imageUrl: shopConfigStore.config.shareImage,
			path: shareUrl
		}
	});

	onShareTimeline(() => {
		return {
			title: shopConfigStore.config.shareTitle,
			imageUrl: shopConfigStore.config.shareImage,
			path: shareUrl
		}
	})
</script>
<style lang="scss" scoped>
	@import './list.scss';
</style>